from django.db import models
import datetime

# Create your models here.

class Poll(models.Model):#The model poll is represented by the class Poll, which subclasses django.db.models.Model
	question = models.CharField(max_length=200)
	pub_date = models.DateTimeField('date published')#'date published' is the human readable name
	def __unicode__(self):
		return self.question
	def was_published_today(self):
		return self.pub_.date() == datetime.date.today()
	
class Choice(models.Model):
	poll = models.ForeignKey(Poll)#relationship: each Choice is related to a single Poll, Ben thinks that poll is an instance of the class Poll
	choice = models.CharField(max_length=200)
	votes = models.IntegerField()
	def __unicode__(self):
		return self.choice
